<%@ page import="com.xinjie.www.po.Tieba" %>
<%@ page import="com.xinjie.www.service.tieba.TiebaServiceImpl" %>
<%@ page import="java.util.List" %>
<%@ page import="java.sql.SQLException" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户写帖子</title>
    <style>
        .input1 {
            border: 1px solid transparent;
            color: transparent;
            outline: 0;
        }
    </style>
</head>
<body>
<%
    TiebaServiceImpl tiebaService = new TiebaServiceImpl();
    List<Tieba> tiebas = null;
    try {
        tiebas = tiebaService.getAllTieba();
    } catch (SQLException | ClassNotFoundException e) {
        e.printStackTrace();
    }
%>
<div align="center">
    <form action="${pageContext.request.contextPath}/write.do" method="get">
        <input type="text" name="method" class="input1" value="1"><br>
        <table>
            <tr>
                <td>主题：</td>
                <td><input type="text" name="title"></td>
            </tr>
            <tr>
                <td>写往贴吧：</td>
                <td><select name="tieba">
                    <%
                        for (Tieba tieba : tiebas) {
                    %>
                    <option><%=tieba.getName()%></option>
                    <%}%>
                </select>
                </td>
            </tr>
            <tr>
                <td>内容：</td>
                <td><textarea name="content" cols="20" rows="10"></textarea></td>
            </tr>
        </table>
        <input type="submit"><br>
        <a href="UserFrame.jsp">返回</a>
        <%if (request.getSession().getAttribute("WriteLose") != null) {%>
        <%=request.getSession().getAttribute("WriteLose")%>
        <%request.getSession().removeAttribute("WriteLose");%>
        <%}%>
        <%if (request.getSession().getAttribute("WriteSeccess") != null) {%>
        <%=request.getSession().getAttribute("WriteSeccess")%>
        <%request.getSession().removeAttribute("WriteSeccess");%>
        <%}%>
    </form>
</div>
</body>
</html>
